#ifndef MYTOOLS_H
#define MYTOOLS_H

#include <string>
#include <sstream>
#include <memory>

class MyTools
{
public:
    ~MyTools();

    void Log(std::string str);
    void Log(std::string filename,int line,std::string str);

    static MyTools *getInstance()
    {
        if (mInstance.get()==0)
        {
            std::auto_ptr<MyTools> tmp(new MyTools);
            mInstance = tmp;
        }
        return mInstance.get();
    }
private:
    static std::auto_ptr<MyTools> mInstance;
    MyTools();
};

#define MYLOG(msg)                                                  \
{                                                                   \
    std::ostringstream os;                                          \
    os << msg;                                                      \
    MyTools::getInstance()->Log( __FILE__ , __LINE__ , os.str());   \
}

#endif // MYTOOLS_H
